//
//  LeftViewController.m
//  Manage
//
//  Created by 杨康 on 2018/1/9.
//  Copyright © 2018年 杨康. All rights reserved.
//

#import "LeftViewController.h"
#import "PersonInfoViewController.h"
#import "UIViewController+CWLateralSlide.h"
#import "MyWalletViewController.h"
#import "MyPackageViewController.h"
@interface LeftViewController ()

@end

@implementation LeftViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UIButton *headButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:headButton];
    [headButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo((SCREEN_WIDTH*0.75-80)/2);
        make.top.mas_equalTo(50);
        make.size.mas_equalTo(CGSizeMake(80, 80));
    }];
    headButton.layer.cornerRadius=40.0;
    headButton.layer.masksToBounds=YES;
    [headButton setBackgroundImage:[UIImage imageNamed:@"默认头像"] forState:UIControlStateNormal];
    [headButton addTarget:self action:@selector(myInfoAction) forControlEvents:UIControlEventTouchUpInside];
    
    UILabel *phoneLab=[SingLeton myLabel:[UIColor colorWithHexString:@"222222"] andTitle:@"13812341234" andFont:16.0];
    [self.view addSubview:phoneLab];
    [phoneLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(headButton.mas_bottom).mas_offset(15);
        make.centerX.mas_equalTo(headButton);
    }];
    
    
    
    YKButton *stateButton=[SingLeton endButton:nil andTitle:@"未认证" RequestSuccess:^(UIButton *btn) {
        
    }];
    [self.view addSubview:stateButton];
    [stateButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(phoneLab.mas_bottom).mas_offset(10);
        make.centerX.mas_equalTo(phoneLab);
        make.size.mas_equalTo(CGSizeMake(50, 20));
    }];
    
    
    stateButton.titleLabel.font=[UIFont systemFontOfSize:12];
    
    [stateButton setBackgroundImage:[NetworkPath createImageWithColor:[UIColor colorWithHexString:@"96ee92"]] forState:UIControlStateNormal];
    [stateButton setBackgroundImage:[NetworkPath createImageWithColor:[UIColor colorWithHexString:@"09be00"]] forState:UIControlStateSelected];
    [stateButton setTitle:@"已认证" forState:UIControlStateSelected];
    stateButton.layer.cornerRadius=3;
    
    
    
    
    UIImageView *packageImg=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"我的套餐"]];
    [self.view addSubview:packageImg];
    [packageImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(30);
        make.top.mas_equalTo(stateButton.mas_bottom).mas_offset(50);
        
    }];
    
    UILabel *packageLab=[SingLeton myLabel:[UIColor colorWithHexString:@"222222"] andTitle:@"我的套餐" andFont:14];
    [self.view addSubview:packageLab];
    [packageLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(packageImg);
        make.left.mas_equalTo(packageImg.mas_right).mas_offset(10);
    }];
    
    
    
    UILabel *dayLab=[SingLeton myLabel:[UIColor color9] andTitle:@"剩余7天" andFont:14];
    [self.view addSubview:dayLab];
    [dayLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-(SCREEN_WIDTH/4+20));
        make.centerY.mas_equalTo(packageImg);
    }];
    
    UIButton *timeButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:timeButton];
    [timeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(packageImg);
        make.top.mas_equalTo(packageImg);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH/4*3-50, 20));
    }];
    [timeButton addTarget:self action:@selector(timeAction) forControlEvents:UIControlEventTouchUpInside];
    
    UIImageView *moneyBagImg=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"我的钱包"]];
    [self.view addSubview:moneyBagImg];
    [moneyBagImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(30);
        make.top.mas_equalTo(packageImg.mas_bottom).mas_offset(40);
        
    }];
    
    UILabel *bagLab=[SingLeton myLabel:[UIColor colorWithHexString:@"222222"] andTitle:@"我的钱包" andFont:14];
    [self.view addSubview:bagLab];
    [bagLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(moneyBagImg);
        make.left.mas_equalTo(moneyBagImg.mas_right).mas_offset(10);
    }];
    
    
    
    UILabel *moneyLab=[SingLeton myLabel:[UIColor color9] andTitle:@"0.00元" andFont:14];
    [self.view addSubview:moneyLab];
    [moneyLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-(SCREEN_WIDTH/4+20));
        make.centerY.mas_equalTo(moneyBagImg);
    }];
    
    UIButton *bagButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:bagButton];
    [bagButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(moneyBagImg);
        make.top.mas_equalTo(moneyBagImg);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH/4*3-50, 20));
    }];
    [bagButton addTarget:self action:@selector(mybagAction) forControlEvents:UIControlEventTouchUpInside];
    
    UIImageView *aboutImg=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"关于我们"]];
    [self.view addSubview:aboutImg];
    [aboutImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(30);
        make.top.mas_equalTo(moneyBagImg.mas_bottom).mas_offset(40);
        
    }];
    
    UILabel *aboutLab=[SingLeton myLabel:[UIColor colorWithHexString:@"222222"] andTitle:@"关于我们" andFont:14];
    [self.view addSubview:aboutLab];
    [aboutLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(aboutImg);
        make.left.mas_equalTo(aboutImg.mas_right).mas_offset(10);
    }];
    
    
    
    
    
    
}
-(void)timeAction
{
    MyPackageViewController *vc=[[MyPackageViewController alloc]init];
    [self cw_pushViewController:vc];
}
-(void)mybagAction
{
    MyWalletViewController *vc=[[MyWalletViewController alloc]init];
    [self cw_pushViewController:vc];
}
-(void)myInfoAction
{
    PersonInfoViewController *vc=[[PersonInfoViewController alloc]init];
    //  在侧滑的控制器内(没有导航控制器)，调用这个方法进行push操作就可以了
    [self cw_pushViewController:vc];
}

@end
